{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 输出\n",
    "print(\"Hello world!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 交互模式输入\n",
    "input()\n",
    "input(\"请输入数字：\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 变量赋值\n",
    "a,b = 111,222\n",
    "print(type(a))\n",
    "print(a)\n",
    "print(b)\n",
    "\n",
    "x = 123\n",
    "z = y = x\n",
    "print(x)\n",
    "print(z)\n",
    "x = 456\n",
    "print(x)\n",
    "print(z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "var1 = int(input(\"请输入数字：\\n\"))\n",
    "var2 = int(input(\"请输入数字：\\n\"))\n",
    "# F-strings 字符串格式化输出\n",
    "print(f\"和：{var1 + var2}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "var1 = input(\"请输入数字：\\n\")\n",
    "var2 = input(\"请输入数字：\\n\")\n",
    "sum = eval(f\"{var1} + {var2}\")\n",
    "print(f\"和：{sum}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
